package com.lanou3g.musicenjoy.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Log;

import com.lanou3g.musicenjoy.fragment.SearchingAlbumFragment;
import com.lanou3g.musicenjoy.fragment.SearchingMVFragment;
import com.lanou3g.musicenjoy.fragment.SearchingSingerFragment;
import com.lanou3g.musicenjoy.fragment.SearchingSingleSongFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by dllo on 15/10/21.
 */
public class SearchingContentActivityAdapter extends FragmentPagerAdapter {
    private String[] titles = {"单曲", "歌手", "专辑", "MV"};
    private List<Fragment> data;
    public SearchingContentActivityAdapter(FragmentManager fm) {
        super(fm);
    }

    public void setData(List<Fragment> data) {
        this.data = data;
        for(Fragment fragment:data){
            Log.i("Sysout", "-->"+fragment.getArguments().getString("url"));

        }
        notifyDataSetChanged();
    }

    @Override
    public Fragment getItem(int position) {
        return data != null && data.size() > 0 ? data.get(position) : null;
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
